package com.fox.stock.job;

import com.fox.stock.service.impl.StockTimeTaskServiceImpl;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class StockJob {

    @Autowired
    private StockTimeTaskServiceImpl stockTimeTaskService;
    /**
     * 1、简单任务示例（Bean模式）
     */
    @XxlJob("myJobHandler")
    public void demoJobHandler() throws Exception {
        System.out.println("当前时间L:" + DateTime.now());
        // default success
    }

    /**
     * 定时获取国内大盘数据
     */
    @XxlJob("getInnerMarketInfo")
    public void getInnerMarketInfoByTime(){
        stockTimeTaskService.getInnerMarketInfo();
    }

    /**
     * 定时获取A股个股数据
     */
    @XxlJob("getStockRtInfo")
    public void getStockRtInfoByTime(){
        stockTimeTaskService.getStockRtIndex();
    }

    /**
     * 定时获取A股板块数据
     */
    @XxlJob("getBlockRtInfo")
    public void getBlockRtInfoByTime(){
        stockTimeTaskService.getBlockRtInfo();
    }

    @XxlJob("getOutMarketInfo")
    public void getOutMarketInfoByTime(){
        stockTimeTaskService.getOutMarketInfo();
    }
}
